﻿#ifndef FORWARD_NODE_H
#define FORWARD_NODE_H

#include <QThread>
#include <QObject>
#include <QSslSocket>
#include <QTcpSocket>
#include <QHostAddress>
#include <QFile>
#include <QSslKey>
#include <QSslConfiguration>
#include <QSslPreSharedKeyAuthenticator>
#include "forward_config.h"
#include "../Command/Command.hpp"

class Forward_Node : public QThread
{
    Q_OBJECT
public:
    Forward_Node(const QJsonObject& info,QObject *parent = nullptr);
    ~Forward_Node();
    
public slots:
    void run();
    void stop(Forward_Node* node);
    
private slots:
    void forwardDataToTarget();
    void forwardDataToSource();
    void leave();
private:
    QTcpSocket* m_appSock= nullptr;
    QSslSocket* m_forwardSock = nullptr;
    QJsonObject m_forwardInfo;
};

#endif // FORWARD_NODE_H
